#include"Slice.hpp"
void sleep_for(int times=5){
    std::chrono::_V2::system_clock::time_point beg=std::chrono::system_clock::now();
    // std::this_thread::sleep_for(std::chrono::duration<long double>{2});
    std::chrono::_V2::system_clock::time_point end=std::chrono::system_clock::now();
    size_t sum=0;
    for(int i=0;i<times;++i){
        beg=std::chrono::system_clock::now();
        std::this_thread::sleep_for(std::chrono::duration<long double>{2});
        end=std::chrono::system_clock::now();
        sum+=(end-beg).count();
    }
    std::cout<<"sleep for 2sec:"<<sum/5<<"ns"<<std::endl;
    sum=0;
    for(int i=0;i<times;++i){
        beg=std::chrono::system_clock::now();
        std::this_thread::yield();
        end=std::chrono::system_clock::now();
        sum+=(end-beg).count();
    }
    std::cout<<"\t\tyield:"<<sum/5<<"ns"<<std::endl;
}
int main(){
    TimeSliceMeasure(20,true);
    // sleep_for();
}

